from starlette.middleware.cors import CORSMiddleware
from api.myscoekt.ResponsePool import mysocket_response_pool
from api.myscoekt.logindata import mysocket_logindata
from api.mysocketio.main import mysocket_chat
from config.app_static_ import *
from api.user import user_info,init_adminuser
from api.community import community
from api.admin import admin
from api.function.qianfan import qianfan
from api.function.docxs import  docxs
from api.lifedata import lifedata
from api.files import files

from Model.init_table import init_staticdata


def init_config(app):
    app.add_middleware(
        CORSMiddleware,
        allow_origins=ALLOW_ORIGINS,
        allow_credentials=True,
        allow_methods=ALLOW_METHODS,
        allow_headers=ALLOW_HEADERS
    )
    init_adminuser()
    init_staticdata()
    app.include_router(user_info)
    app.include_router(community)
    app.include_router(admin)
    app.include_router(qianfan)
    app.include_router(docxs)
    app.include_router(lifedata)
    app.include_router(files)
    app.include_router(mysocket_logindata)
    app.include_router(mysocket_response_pool)
    app.include_router(mysocket_chat)









